//
//  ContactsSuccessViewController.m
//  MFWebBrowser
//
//  Created by Dream on 2018/8/2.
//  Copyright © 2018年 Dream. All rights reserved.
//

#import "ContactsSuccessViewController.h"

@interface ContactsSuccessViewController ()

@end

@implementation ContactsSuccessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title = @"通讯录认证";
    self.view.backgroundColor = [UIColor colorWithRed:246/255.0 green:247/255.0 blue:251/255.0 alpha:1.0];
    
    //屏幕宽高
    CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
    CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 260)];
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    
    //成功icon
    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
    NSBundle *resourcesBundle = [NSBundle bundleWithPath:[bundle pathForResource:@"ContactsResources" ofType:@"bundle"]];
    
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bt_success" inBundle:resourcesBundle compatibleWithTraitCollection:nil]];
    
    imageView.center = CGPointMake(screenWidth * 0.5, 135);
    [view addSubview:imageView];
    
    //成功文字
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(imageView.frame) + 20, screenWidth, 30)];
    titleLabel.textColor = [UIColor blackColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
    [view addSubview:titleLabel];
    
    titleLabel.text = @"你已完成通讯录认证";
    
    //确认按钮
    UIButton *upButton = [[UIButton alloc] initWithFrame:CGRectMake(15, screenHeight - 100, screenWidth - 30, 44)];
    
    upButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
    [upButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [upButton setTitle:@"完成" forState:UIControlStateNormal];
    
    upButton.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.7];
    
    [upButton addTarget:self action:@selector(doneAction) forControlEvents:UIControlEventTouchUpInside];
    
    upButton.layer.cornerRadius = 22;
    upButton.layer.masksToBounds = YES;
    
    [self.view addSubview:upButton];
}

- (void)doneAction
{
    //返回
    NSUInteger index = [self.navigationController.childViewControllers indexOfObject:self];
    
    UIViewController *popVC = self.navigationController.childViewControllers[index - 2];
    
    [self.navigationController popToViewController:popVC animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
